From 1a25f43420fdd11be37048dc28932a726e9c150f Mon Sep 17 00:00:00 2001 From: robertlipe Date: Tue, 20 Jan 2015 02:39:51 +0000 Subject: [PATCH] Eliminate use of strptime in cst. --- gpsbabel/cst.cc | 17 +++++++---------- gpsbabel/parse.cc | 1 - 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/gpsbabel/cst.cc b/gpsbabel/cst.cc index e307db2a7..04d4b3cc8 100644 --- a/gpsbabel/cst.cc +++ b/gpsbabel/cst.cc @@ -22,7 +22,6 @@ #include "defs.h" #include "cet_util.h" -#include "strptime.h" #include #include @@ -248,7 +247,6 @@ cst_data_read(void) } else { int interp, i; char name[256]; - char* pow; if (data_lines < 0) { if ((2 != sscanf(cin, "%d %128s", &i, name)) || @@ -284,14 +282,13 @@ cst_data_read(void) wpt->shortname = QString::fromLatin1(((char*)&name) + 5); } - pow = strrchr(cin, '^'); - if (pow != NULL) { - struct tm tm; - - pow = lrtrim(++pow); - strptime(pow, "%Y %m %d %H:%M:%S", &tm); - - wpt->SetCreationTime(mkgmtime(&tm)); + QString time_string(cin); + int caret = time_string.indexOf('^'); + if (caret > -1) { + QString dts = time_string.mid(caret + 1).trimmed(); + QDateTime dt = QDateTime::fromString(dts, "yyyy MM dd hh:mm:ss"); + dt.setTimeSpec(Qt::UTC); + wpt->SetCreationTime(dt); } wpt->latitude /= 100000.0; wpt->longitude /= 100000.0; diff --git a/gpsbabel/parse.cc b/gpsbabel/parse.cc index 9003a9c86..6540b94b5 100644 --- a/gpsbabel/parse.cc +++ b/gpsbabel/parse.cc @@ -22,7 +22,6 @@ #include "defs.h" #include "jeeps/gpsmath.h" -#include "strptime.h" #include #include #include //strtod -- 2.30.2